<template>
	<view class="p20">
		<view class="w100">
			<block v-if="contents.length > 0">
			<view class="w100 dis p10 bors" v-for="(item,index) in contents" :key="index" @click="inform_details(item.noticeId)">
				<image class="images" src="../../../static/img/detailsMsg/announcement.png" mode=""></image>
				<view class="p15">
					<view class="co34">{{item.noticeTitle}}</view>
					<view class="co98">{{item.createTime}}</view>
				</view>
			</view>
			</block>
			<block v-else>
				<nullPage></nullPage>
			</block>
		</view>
	</view>
</template>

<script>
	import submit from "@/serve/api/submit.js"
	import nullPage from '@/common/null.vue' //选择器值 
	export default {
		components: {
			nullPage
		},
		data() {
			return {
				contents: [],
				pageNum: 1,
				getListFlag: true,
			}
		},
		onLoad(opction) {
			this.systemst()
		},
		onReachBottom(e) {
			if (this.getListFlag) {
				this.pageNum = this.pageNum + 1;
				this.systemst();
			}
		},
		methods: {
			//系统通知
			async systemst() {
				let parame = {
					pageNum: this.pageNum,
					pageSize: 10,
				}
				const res = await submit.selectNoticeList(parame);
				// this.content = res.data.data
				this.contents = this.contents.concat(res.data.data)
				if (res.data.data.length < 10 && this.contents.length > 0) {
					uni.showToast({
						title: '已加载全部',
						icon: 'none'
					})
				} else if (res.data.data == []) {
					uni.showToast({
						title: '暂无数据',
						icon: 'none'
					})
				}
			},
			//公告详情跳转
			inform_details(e) {
				uni.navigateTo({
					url: 'inform_details?id=' + e
				})
			},

		}
	}
</script>

<style>
	page {
		min-height: 100%;
		background-color: #FFFFFF;
	}

	.p20 {
		background-color: #FFFFFF;
		padding: 0 20px;
	}

	.w100 {
		width: 100%;
	}

	.dis {
		display: flex;
		align-items: center;
	}

	.images {
		width: 15px;
		height: 15px;
	}

	.p10 {
		padding: 20px 0;
	}

	.bors {
		border-bottom: 1px solid #F2F4F8;
	}

	.p15 {
		padding-left: 15px;
	}

	.co34 {
		font-size: 16px;
		color: #34363D;
		font-weight: bold;
	}

	.co98 {
		font-size: 14px;
		color: #989BA6;
		margin-top: 10px;
	}
</style>
